package com.app.controller;

import com.app.model.RecruitModel;
import com.app.service.RecruitService;
import com.app.util.Result;
import com.app.vo.RecruitModelVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

//招工用工API
@Controller
@RestController
@RequestMapping("/api/recruit")
public class RecruitController {

    @Autowired
    private RecruitService recruitService;

    //查询所有招工用工
    @GetMapping("/getRecruitList")
    public Result<Object> getRecruitList(@RequestParam(defaultValue = "0") Integer page,
                                         @RequestParam(defaultValue = "10") Integer limit) {
        RecruitModelVo recruitList = recruitService.getRecruitList(page, limit);
        return Result.success(recruitList);
    }

    //招工用工查询详情
    @GetMapping("/getRecruit")
    public Result<Object> getRecruit(@RequestParam Integer id) {
        RecruitModel recruit = recruitService.getRecruitById(id);
        return Result.success(recruit);
    }


}
